import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VideoPlanVO, VideoPlanForm, VideoPlanQuery } from '@/api/biz/videoPlan/types';

/**
 * 查询视频预案列表
 * @param query
 * @returns {*}
 */

export const listVideoPlan = (query?: VideoPlanQuery): AxiosPromise<VideoPlanVO[]> => {
  return request({
    url: '/biz/videoPlan/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询视频预案详细
 * @param id
 */
export const getVideoPlan = (id: string | number): AxiosPromise<VideoPlanVO> => {
  return request({
    url: '/biz/videoPlan/' + id,
    method: 'get'
  });
};

/**
 * 新增视频预案
 * @param data
 */
export const addVideoPlan = (data: VideoPlanForm) => {
  return request({
    url: '/biz/videoPlan',
    method: 'post',
    data: data
  });
};

/**
 * 修改视频预案
 * @param data
 */
export const updateVideoPlan = (data: VideoPlanForm) => {
  return request({
    url: '/biz/videoPlan',
    method: 'put',
    data: data
  });
};

/**
 * 删除视频预案
 * @param id
 */
export const delVideoPlan = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/videoPlan/' + id,
    method: 'delete'
  });
};
